package org.jeecg.modules.scm.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.scm.entity.ScmFinaContract;
import org.jeecg.modules.scm.mapper.ScmFinaContractMapper;
import org.jeecg.modules.scm.service.IScmFinaContractService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: scm_fina_contract
 * @Author: jeecg-boot
 * @Date: 2021-11-26
 * @Version: V1.0
 */
@Service
public class ScmFinaContractServiceImpl extends ServiceImpl<ScmFinaContractMapper, ScmFinaContract> implements IScmFinaContractService {

    @Override
    public List<ScmFinaContract> getListByInvestorId(Integer investorId) {

        LambdaQueryChainWrapper<ScmFinaContract> queryChainWrapper = lambdaQuery()
                .eq(ScmFinaContract::getInvestorId, investorId)
                .orderByDesc(ScmFinaContract::getApplyDdl);

        return queryChainWrapper.list();
    }

    @Override
    public List<ScmFinaContract> getListByItemId(Integer itemId) {
        LambdaQueryChainWrapper<ScmFinaContract> queryChainWrapper = lambdaQuery()
                .eq(ScmFinaContract::getItemId, itemId)
                .orderByDesc(ScmFinaContract::getApplyDdl);
        return queryChainWrapper.list();
    }
}
